//
//  ViewController.swift
//  StaticSwift
//
//  Created by Guo Longxiang, (Longxiang.Guo@partner.bmw.com) on 03/04/2020.
//  Copyright (c) 2020 Guo Longxiang, (Longxiang.Guo@partner.bmw.com). All rights reserved.
//

import UIKit
import StaticSwift

class ViewController: UIViewController {
    
    var instance: StaticSwift!
    override func viewDidLoad() {
        super.viewDidLoad()
        instance = StaticSwift(key: "hehe");
        // Do any additional setup after loading the view, typically from a nib.
    }
    
    override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
        instance.startPay(order: Order(name: "Mac", price: 20000)) { (result, error, reponse) in
            print(reponse ?? "")
        }
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }

}

class Order: CustomStringConvertible{
    
    let name: String!
    let price: Int!
    init(name: String, price: Int) {
        self.name = name
        self.price = price
    }
     
    var description: String {
        return "\(String(describing: name)): \(String(describing: price))"
    }
}

